﻿using AutoMapper;
using CaltechSoft.Service.EntityFW.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ServiceModel = CaltechSoft.Service.DBCommand;

namespace CaltechSoft.Service
{
    public class ObjectMapper
    {
        private static bool _mapped;

        public static void RegisterMapper()
        {
            if (!_mapped)
            {
                Mapper.CreateMap<Certificate, ServiceModel.CreateNewCertificateCommand>()
                    .ForMember("PoNumber", map => map.MapFrom(d => d.PONumber))
                    .ForMember("Inspector", map => map.MapFrom(d => d.QualityInspector))
                    ;

                Mapper.CreateMap<Customer, ServiceModel.TransactionCustomerModel>()
                    .ForMember("Name", map => map.MapFrom(d => d.Name))
                    ;

                Mapper.CreateMap<CertificateStandard, ServiceModel.StandardModel>();


                _mapped = true;
            }
        }
    }
}
